# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtnetworkauth
pkgver=5.15.10_git20230424
pkgrel=1
_module="${pkgname#qt5-}"
_pkgver=a0f23c6a1f11bd7c6a8e4fd34f10bdb0a35789fa
_fullname=$_module-$_pkgver
arch="all !armhf" # armhf blocked by qt5-qtdeclarative
url="https://www.qt.io/developers/"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
pkgdesc="Network authentication module"
makedepends="qt5-qtbase-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://dev.alpinelinux.org/archive/qt/$_fullname.tar.xz"
builddir="$srcdir/$_fullname"

_disturl="dev.alpinelinux.org:/archive/qt/"
snapshot() {
	clean
	makedepends="git xz rsync tar" deps
	mkdir -p "$srcdir" && cd "$srcdir"
	git clone --filter=tree:0 https://invent.kde.org/qt/qt/$_module.git .
	git archive --format tar --prefix=$_fullname/ $_pkgver > "$SRCDEST"/$_fullname.tar
	xz -vv -T0 -9 -e "$SRCDEST"/$_fullname.tar
	rsync --progress -La "$SRCDEST"/$_fullname.tar.xz $_disturl
}

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	install -d "$pkgdir"/usr/share/licenses
	ln -s qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
ffb7ecd43aecc41bc901fad9deb818dd777389e712d0ee050c279f10397c01227ec6983ff0b4b16dd21b383c444474c49ab9b95c6542915d7ea03ad3333caf9b  qtnetworkauth-a0f23c6a1f11bd7c6a8e4fd34f10bdb0a35789fa.tar.xz
"
